<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------

//公众号响应事件
Route::any('api/wx/response/[:account]', 'api.wechat/response');

/** 前台管理 */
Route::group('webhook', function () {
    Route::post('git/push', 'webhook.git/push');
});


/** 后台管理 */
Route::group('admin', function () {
    Route::get('login', 'admin.auth/index');
    Route::get('auth/logout', 'admin.auth/logout');
    Route::get('auth/captcha', 'admin.auth/captcha');
    Route::post('auth/login', 'admin.auth/login');
    Route::get('auth/refresh', 'admin.auth/refresh');

    Route::get('dashboard/index', 'admin.dashboard/index');

    Route::group('manage', function () {
        Route::get('list', 'admin.manage/list');
        Route::any('edit', 'admin.manage/edit');
        Route::get('del', 'admin.manage/del');
        Route::any('password', 'admin.manage/password');
    });
    Route::group('role', function () {
        Route::get('list', 'admin.role/list');
        Route::any('edit', 'admin.role/edit');
        Route::any('auth', 'admin.role/auth');
        Route::get('del', 'admin.role/del');
    });

    Route::group('permission', function () {
        Route::get('list', 'admin.permission/list');
        Route::any('edit', 'admin.permission/edit');
        Route::get('del', 'admin.permission/del');
        Route::get('group', 'admin.permission/groupList');
        Route::any('group_edit', 'admin.permission/groupEdit');
        Route::any('group_del', 'admin.permission/groupDel');
    });
})->middleware('CheckPermission');

/**
 * debug环境下测试代码
 */
Route::group('demo', function () {
    Route::controller('normal', 'demo.normal');
    Route::get('wx/auth','demo.easywechat/getAuth')->middleware('WechatAuth:default,userinfo'); //优先级
    Route::controller('wx','demo.easywechat');
    Route::controller('qiniu','demo.qiniu');
    Route::controller('db','demo.database');

    Route::group('ai', function () {
        Route::get('baidu', 'demo.artificial/baidu');
        Route::get('qq', 'demo.artificial/qq');
    });
});

/**
 * 匹配不到时直接去Wtf controller
 */
Route::miss('wtf/index');

